﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wilson/MP/Base.Master" AutoEventWireup="true" CodeBehind="LinkEdit.aspx.cs" Inherits="WebsiteAdmin.Wilson.LinkInfo.LinkEdit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head_Title" runat="server">链接编辑 - 链接</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Head_Meta" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Head_Css" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Head_Script" runat="server">
    <script type="text/javascript" src="/Script/Mootools.Smoothbox.js"></script>
<script type="text/javascript" language="javascript">
    var MenuViewID = 6;
    window.addEvent('domready', function() {
        $('submitbtn').addEvent('click', function() {
            Submit();
        });
    });

    function Submit() {
        var txtLinkTitle = $('txtLinkTitle').get('value').trim();
        if (txtLinkTitle.length == 0) {
            alert('链接标题错误');
            return false;
        }
        var txtLinkURL = $('txtLinkURL').get('value').trim();
        var txtSortBy = $('txtSortBy').get('value').trim().toInt();
        if (isNaN(txtSortBy)) {
            alert('必须是整数');
            return false;
        }
        Update(
        txtLinkTitle,
        txtLinkURL,
        txtSortBy);
    }
    
    function Update(txtLinkTitle,
        txtLinkURL,
        txtSortBy) {

        new Request.JSON({
            method: 'post',
            url: 'Handler/Update.ashx',
            data: {
                PKID:<%=pkid %>,
                LinkTitle: txtLinkTitle,
                LinkURL: txtLinkURL,
                SortBy: txtSortBy
            },
            noCache: true,
            onSuccess: function(data, text) {
                if (data.Done == 'Success') { 
                    
                    if(confirm('修改成功，返回列表？'))
                    {
                        document.location.href = '/Wilson/LinkInfo/LinkList.aspx';
                    };
                    LightBox.remove();
                }
                else
                {
                    alert('修改失败');
                    LightBox.remove();
                }
            },
            onFailure: function(xhr) {
                alert(xhr.statusText);
                LightBox.remove();
            }
        }).send();
    }
    
</script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Body_Top" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Body_Content" runat="server">
    <div class="infobox">
    <h3>
    <span>链接编辑</span>
		<a href="/Wilson/LinkInfo/LinkList.aspx" class="back action">返回链接列表</a>
    </h3>
    <div class="mt10">
        <form id="MyForm" action="">
    <table border="0" cellpadding="0" cellspacing="0" class="table_form">
        <tr>
            <td align="right" width="100">
                <span class="Need">标题：</span></td>
            <td>
                <input type="text" id="txtLinkTitle" name="txtLinkTitle" style="width:300px;" value="<%=linkTitle %>" maxlength="40" />
                <font color="red">*</font>
            </td>
        </tr>
        <tr>
            <td align="right">
                链接：
            </td>
            <td>
                <input type="text" id="txtLinkURL" style="width:400px;" value="<%=linkURL %>" />
            </td>
        </tr>            
        <tr id="TRscript">
            <td align="right">
                <span class="Need">排序：</span></td>
            <td>
                <input id="txtSortBy" type="text" style="width:50px;" maxlength="3" value="<%=sortBy %>" /><font color="red">&nbsp;*<span id="Span1"></span></font></td>
        </tr>
    </table>
    <table border="0" cellpadding="0" cellspacing="0" class="table_form">
		<tr>
			<td width="100" height="40">&nbsp;</td>
			<td>
				<input id="submitbtn" type="button" value="提交" class="btn" />
				<input type="reset" value="重置" class="btn" />
			</td>
		</tr>
	</table>
    </form>
    </div>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="Body_Foot" runat="server">
</asp:Content>
